package ar.edu.unicen.exa.oop.bbquery.view.mediators;

import javax.swing.JLabel;

import org.puremvc.java.multicore.interfaces.INotification;
import org.puremvc.java.multicore.patterns.mediator.Mediator;

import ar.edu.unicen.exa.oop.bbquery.facade.AppFacade;

public class LabelMediator extends Mediator {

	public static String NAME="LabelMediator";
	
	public LabelMediator(JLabel viewComponent) {
		super(NAME, viewComponent);
	}
	
	@Override
	public String[] listNotificationInterests()
	{
		return new String[] {AppFacade.DATA_CHANGED};
	}
	
    public void handleNotification(INotification notification)
	{    
    	if(notification.getName().equals(AppFacade.DATA_CHANGED))
		{
            System.out.println("handleNotification (mediator) " + notification.getType());
            String mydata = (String) notification.getType();
            JLabel label = (JLabel) viewComponent;
            label.setText(mydata);
            label.repaint();
		}
	}

	
}
